package com.guodefu.sensitive.handler;

import com.guodefu.sensitive.config.SensitiveStrategy;

public class EmailSensitiveStrategy implements SensitiveStrategy {
    @Override
    public String mask(String email, String maskString) {
        int atIndex = email.indexOf("@");
        if (atIndex <= 1) {
            return email.charAt(0) + maskString;
        }
        return email.substring(0, 2) + maskString + email.substring(atIndex);
    }
}
